package com.javabasic.algorithm.newcode;

import java.util.HashMap;
import java.util.Scanner;

/**
 * @Author xiongmin
 * @ClassName 数组移动跳跃
 * @Description TODO
 * @Date 2019/9/1 12:10
 * @Version 1.0
 **/
public class 数组移动跳跃 {
    static Scanner cin = new Scanner(System.in);

    public static void main(String[] args) {
        String str = cin.next();
        str = str.substring(1,str.length()-1);
        String[] split = str.split(",");
        int arr[] = new int[split.length];
        for (int i = 0; i < split.length; i++) {
            arr[i] = Integer.parseInt(split[i]);
//            System.out.print(arr[i] + " ");
        }
        int index = 0, temp = 0;
        HashMap<Integer, Integer> map = new HashMap<>();

        while (index >= 0 && index < split.length && map.containsKey(index) == false) {
//            System.out.println(index);
            map.put(index,1);
            temp = arr[index];
//            System.out.println(temp);
            index += temp;
        }
//        System.out.println(index);
        if (map.containsKey(index)) {
            System.out.println("false");
        } else {
            System.out.println("true");
        }


    }
}
